<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    /*var t = 'a';
    function test(){
      alert(t);
      console.log(t)
      var t = 'b';
      alert(t);
      console.log(t)
    }
    test();*/
    /* var t = 'a';
    function test(){
      var t;
      alert(t);
      t = 'b';
      alert(t);
    }
    test(); */
  </script>
  <script>
    /* var t = 'a';
    function test(){
      console.log(t);
      var t = 'b';
      alert(t);
      console.log(t);
    }
    alert(t);
    test(); */
  </script>
  <script>
    var a = 1;
    function r(){
      console.log(a);
      eval('a = 2');
      console.log(a);
    }
    r();
  </script>
</body>
</html>